package com.ruoyi.appreciate.graphy.service.impl;

import java.util.List;

import com.ruoyi.appreciate.graphy.domain.StyleGraphy;
import com.ruoyi.appreciate.graphy.mapper.StyleGraphyMapper;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.appreciate.graphy.service.IStyleGraphyService;

/**
 * 书体欣赏Service业务层处理
 *
 * @author duanxinli
 * @date 2025-09-11
 */
@Service
public class StyleGraphyServiceImpl implements IStyleGraphyService {
    @Autowired
    private StyleGraphyMapper styleGraphyMapper;

    /**
     * 查询书体欣赏
     *
     * @param id 书体欣赏主键
     * @return 书体欣赏
     */
    @Override
    public StyleGraphy selectStyleGraphyById(String id) {
        return styleGraphyMapper.selectStyleGraphyById(id);
    }

    /**
     * 查询书体欣赏列表
     *
     * @param styleGraphy 书体欣赏
     * @return 书体欣赏
     */
    @Override
    public List<StyleGraphy> selectStyleGraphyList(StyleGraphy styleGraphy) {
        return styleGraphyMapper.selectStyleGraphyList(styleGraphy);
    }

    /**
     * 新增书体欣赏
     *
     * @param styleGraphy 书体欣赏
     * @return 结果
     */
    @Override
    public int insertStyleGraphy(StyleGraphy styleGraphy) {
        styleGraphy.setId(IdUtils.fastUUID());
        styleGraphy.setCreateDate(DateUtils.getNowDate());
        String username = SecurityUtils.getUsername();
        styleGraphy.setCreateBy(username);
        styleGraphy.setSort(0L);
        styleGraphy.setDelFlag(0L);
        return styleGraphyMapper.insertStyleGraphy(styleGraphy);
    }

    /**
     * 修改书体欣赏
     *
     * @param styleGraphy 书体欣赏
     * @return 结果
     */
    @Override
    public int updateStyleGraphy(StyleGraphy styleGraphy) {
        return styleGraphyMapper.updateStyleGraphy(styleGraphy);
    }

    /**
     * 批量删除书体欣赏
     *
     * @param ids 需要删除的书体欣赏主键
     * @return 结果
     */
    @Override
    public int deleteStyleGraphyByIds(String[] ids) {
        return styleGraphyMapper.deleteStyleGraphyByIds(ids);
    }

    /**
     * 删除书体欣赏信息
     *
     * @param id 书体欣赏主键
     * @return 结果
     */
    @Override
    public int deleteStyleGraphyById(String id) {
        return styleGraphyMapper.deleteStyleGraphyById(id);
    }
}
